package dreamCookGame;

import java.awt.image.BufferedImage;

public class BottomMenu {
	
	BufferedImage _img;
	BufferedImage[] _images;
	int _x;
	int _y;
	
	public BottomMenu(int x, int y) {
		_x = x;
		_y = y;
		_images = new BufferedImage[6];
		
		for(int i = 0; i < _images.length; i++)
			_images[i] = new BufferedImage(1,1, BufferedImage.TYPE_INT_ARGB);
	}
	
	public void loadResources(References reference) {
		_images[0] = reference.getImage("bottomMenu");
		_images[1] = reference.getImage("bottomMenuSatchelHighlight");
		_images[2] = reference.getImage("bottomMenuMenuHighlight");
		_images[3] = reference.getImage("bottomMenuVolumeHighlight");
		_images[4] = reference.getImage("bottomMenuVolumeCancel");
		_images[5] = reference.getImage("bottomMenuCancelHighlight");
		
		_img = _images[0];
	}
	
	public void changeState(int state) {
		_img = _images[state];
	}	
	
	public boolean isWithinMenu(int x, int y) {
		int leftBound = _x;
		int rightBound = _x + _img.getWidth();
		int topBound = _y;
		int bottomBound = _y + _img.getHeight();
		
		if(x >= leftBound && x <= rightBound && y >= topBound && y <= bottomBound)
			return true;
		
		return false;
	}
	
	public boolean isOnSatchel(int x, int y) {
		int leftBound = _x + 21;
		int rightBound = _x + 135;
		int topBound = _y + 18;
		int bottomBound = _y + 102;
		
		if(x >= leftBound && x <= rightBound && y >= topBound && y <= bottomBound)
			return true;
		
		return false;
	}
	
	public boolean isOnMenuButton(int x, int y) {
		int leftBound = _x + 169;
		int rightBound = _x + 243;
		int topBound = _y + 48;
		int bottomBound = _y + 74;
		
		if(x >= leftBound && x <= rightBound && y >= topBound && y <= bottomBound)
			return true;
		
		return false;
	}
	
	public boolean isOnVolume(int x, int y) {
		int leftBound = _x + 240;
		int rightBound = _x + 269;
		int topBound = _y + 13;
		int bottomBound = _y + 103;
		
		if(x >= leftBound && x <= rightBound && y >= topBound && y <= bottomBound)
			return true;
		
		return false;
	}
}
